package com.auxgroup.hr.front.site.co.common;

import java.util.List;

import javax.annotation.Resource;

import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.auxgroup.hr.front.commons.BaseRetCode;
import com.auxgroup.hr.front.commons.vo.BaseResponseVO;
import com.auxgroup.hr.front.dao.domain.PsCountryTbl;
import com.auxgroup.hr.front.dozer.IObjectMapper;
import com.auxgroup.hr.front.service.personnal.CountryTblService;
import com.auxgroup.hr.front.site.co.BaseCO;

/**
 * 国家数据CO
 * @author wangchangyun
 * @version 创建时间：180527 
 */
@RestController
@RequestMapping("${auxgroup.hr.contextPath}/countryTbl")
public class CountryTblCO extends BaseCO {

	private static final Logger logger = LoggerFactory.getLogger(CountryTblCO.class);

	@Autowired
	public CountryTblService countryTblService;

	@Resource(name = "dozerMapper")
	protected IObjectMapper objectMapper;

	/**
	 * 获取国家数据
	 * @param hireId
	 * @return
	 */
	@GetMapping(value = "/getOne")
	public BaseResponseVO getOne(String country) {
		logger.info("getCountryTbl param= {}", country);
		if(StringUtils.isBlank(country)){
			buildRespone(BaseRetCode.CODE_ERROR_REQUEST_PARAM_NULL);
		}
		PsCountryTbl countryTbl = countryTblService.getCountryTbl(country);
		return buildRespone(countryTbl,false);
	}
	
	/**
	 * 获取全部国家数据
	 * @param rsHireId
	 * @return
	 */
	@GetMapping(value = "/getAll")
	public BaseResponseVO getAll(){
		List<PsCountryTbl> list = countryTblService.getAll();
		return buildRespone(list,false);
	}
	
	

}
